/// @tags: SAM
#include <cctype>
#include <cstdio>
#include <map>

typedef long long ll;

int const N = 1e5 + 5;

template <typename T>
inline T &read(T &x) {
  x = 0;
  bool f = false;
  short ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = true;
    ch = getchar();
  }
  while (isdigit(ch)) x = x * 10 + (ch ^ '0'), ch = getchar();
  if (f) x = -x;
  return x;
}

struct Node {
  int link, len;
  std::map<int, int> ch;
} sam[N << 1];

int n, tot = 1, las = 1;
ll ans;

inline void insert(int c) {
  sam[++tot].len = sam[las].len + 1;
  int pos = las, cur = tot;
  while (pos && !sam[pos].ch[c]) sam[pos].ch[c] = cur, pos = sam[pos].link;
  if (!pos) sam[cur].link = 1;
  else {
    int q = sam[pos].ch[c];
    if (sam[q].len == sam[pos].len + 1) sam[cur].link = q;
    else {
      int clone = ++tot;
      sam[clone] = sam[q];
      sam[clone].len = sam[pos].len + 1;
      sam[q].link = sam[cur].link = clone;
      while (pos && sam[pos].ch[c] == q) sam[pos].ch[c] = clone, pos = sam[pos].link;
    }
  }
  ans += sam[cur].len - sam[sam[cur].link].len;
  las = cur;
}

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("P4070 [SDOI2016]生成魔咒.in", "r", stdin);
  freopen("P4070 [SDOI2016]生成魔咒.out", "w", stdout);
#endif
#endif

  read(n);
  for (int i = 1, x; i <= n; ++i) insert(read(x)), printf("%lld\n", ans);
  return 0;
}